# -*- coding: utf8 -*-
from flask import Flask
from flask_restful import Api
from .resource.beidou_grid_code_two_dimension import BeiDouGridCode2DimensionPoint
from .resource.beidou_grid_code_two_dimension import BeiDouGridCode2DimensionLine
from .resource.beidou_grid_code_two_dimension import BeiDouGridCode2DimensionPolygon


def create_app():
    app = Flask(__name__)
    restful_app = Api(app=app)
    restful_app.add_resource(BeiDouGridCode2DimensionPoint, '/beidou/grid/2dimension/point')
    restful_app.add_resource(BeiDouGridCode2DimensionLine, '/beidou/grid/2dimension/line')
    restful_app.add_resource(BeiDouGridCode2DimensionPolygon, '/beidou/grid/2dimension/polygon')
    #
    app.add_url_rule(rule='/index', view_func=index)

    return app



def index():
    return 'hello world!'

